feat!: require Node 24 and migrate CJS to ESM output#3045
Closed
bennypowers wants to merge 7 commits into
Closed
Conversation
🦋 Changeset detectedLatest commit: dec9658 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 17, 2026 11:52
f2b5763 to
f8015fd
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 17, 2026 11:52
a38ded7 to
010ef78
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 17, 2026 12:53
f8015fd to
18a0066
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
2 times, most recently
from
March 17, 2026 14:57
8bd2017 to
268a3ff
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
2 times, most recently
from
March 17, 2026 16:48
a2a3658 to
eb87c8d
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 17, 2026 16:48
268a3ff to
61bf92a
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
2 times, most recently
from
March 17, 2026 18:02
b1a23e2 to
b77e600
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 17, 2026 18:02
b5e6238 to
32ba55e
Compare
bennypowers
marked this pull request as draft
March 17, 2026 18:34
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 17, 2026 19:01
b77e600 to
10e9722
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 17, 2026 19:01
32ba55e to
5abe25a
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 18, 2026 12:08
10e9722 to
d3acddd
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
2 times, most recently
from
March 18, 2026 13:33
4fb3367 to
4926432
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
2 times, most recently
from
March 18, 2026 14:47
441c093 to
e99e801
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
2 times, most recently
from
March 18, 2026 14:58
6aab5fb to
1effc4f
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 18, 2026 14:58
e99e801 to
f9df49b
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 18, 2026 17:03
1effc4f to
74db169
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 18, 2026 17:03
f9df49b to
16c8d24
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 19, 2026 06:13
74db169 to
2c9b144
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
2 times, most recently
from
March 19, 2026 07:07
e8cf07b to
e4d58b4
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 19, 2026 07:07
2c9b144 to
6de56b9
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 19, 2026 17:01
4841973 to
0a62b2c
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 19, 2026 17:01
5549599 to
83a016b
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 19, 2026 17:40
0a62b2c to
badf76c
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
2 times, most recently
from
March 19, 2026 17:56
f92e889 to
fe5ef17
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 19, 2026 17:56
badf76c to
059908a
Compare
4 tasks
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 19, 2026 18:03
fe5ef17 to
fa00235
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 20, 2026 06:53
c40dc3e to
fdff965
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 20, 2026 06:53
fa00235 to
6152fa0
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 20, 2026 12:20
fdff965 to
037552b
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
from
March 22, 2026 03:58
6152fa0 to
853196c
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 22, 2026 05:41
037552b to
0c3de8d
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
3 times, most recently
from
March 22, 2026 08:26
1e7a44c to
3b0e109
Compare
bennypowers
force-pushed
the
node24/test-migration
branch
from
March 22, 2026 09:42
49b4991 to
2cc8e4e
Compare
bennypowers
force-pushed
the
node24/esm-and-node24
branch
4 times, most recently
from
March 23, 2026 06:02
50f5b06 to
708a7ce
Compare
5 tasks
BREAKING CHANGE: Node 24+ is now required. All packages emit ESM. - Add "type": "module" to all package.json files - Update exports to use single "default" condition (remove CJS/ESM dual exports) - Update engines to require Node >=24.0.0 - Delete all index.mjs shim files (34 files) - Fix CJS interop issues across source files: - require.resolve → import.meta.resolve / createRequire - __dirname → import.meta.dirname - Default import interop for CJS packages (rollup plugins, saucelabs, etc.) - Add .nvmrc (v24.11.1) - Add changeset for breaking node version requirement Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restore parse5 to ^6.0.1 in all packages (v8 migration is PR4) - Add @ts-ignore for rollupPluginExternalGlobals usage sites - Regenerate package-lock.json Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update all package.json exports to use "default" condition - Remove "module" field from packages (ESM via "type": "module") - Fix "main" field for packages with changed entry points - Keep JSDoc packages (parse5-utils, config-loader, rollup-plugin-copy, rollup-plugin-import-meta-assets, storybook-utils) WITHOUT "type": "module" since their .js source uses require() -- converted to ESM in PR4 - Restore parse5-utils index.mjs ESM wrapper with createRequire - Apply CJS interop fixes (import.meta.resolve, createRequire) for source files that used require.resolve/__dirname Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JSDoc packages (config-loader, rollup-plugin-copy, rollup-plugin-import-meta-assets) have CJS source in src/, not compiled output in dist/. The exports map must point to src/ for runtime resolution to work. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
browserScript.ts reads compiled serialize.js and logUncaughtErrors.js at runtime and injects them into the browser via page.evaluate(). With ESM output, these files have `export` keywords which are invalid in non-module browser script context. Strip them on read. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test reads dist/serialize.js directly and injects it into the browser via page.evaluate. Need to strip ESM export keyword there too, not just in browserScript.ts. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Author
|
Replaced by #3049 (combined with PR2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BREAKING CHANGE: Node 24+ is now required. All packages emit ESM output.
"type": "module"to all TypeScript package.json files(JSDoc packages remain CJS until PR4 converts them)
"default"condition"module"field (replaced by"type": "module")node >=24.0.0index.mjsshim files (no longer needed with native ESM)require.resolve()->import.meta.resolve()/createRequire()__dirname->import.meta.dirname.nvmrc(v24.11.1)This is PR 3 of 4 in the Node 24 migration stack.
Stack
node24/typescript-upgrade-- TypeScript upgrade +.tsimports (chore: upgrade TypeScript to 5.9.3 and enable .ts imports #3043)node24/test-migration-- mocha/chai to node:test migration (chore: migrate tests from mocha/chai to node:test #3044)node24/parse5-and-jsdoc-- parse5 v8 + JSDoc to TS conversions (feat!: migrate parse5 to v8 and convert JSDoc packages to TypeScript #3046)Test plan
npm run buildpasses with zero TS errorsexport/importsyntax)Generated with Claude Code